home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / buildDefaultSceneUI.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.3 KB  |  213 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Description:
  22. //        This script is executed when a file is opened.  It will create panels
  23. //        only if no panels exist.
  24. //
  25. //  Creation Date: 
  26. //  Author:         
  27. //
  28.  
  29. global proc buildDefaultSceneUI() {
  30.     global string      $gMainPane;
  31.  
  32.     if (`paneLayout -exists $gMainPane`) {
  33.         string $panels[] = `getPanel -all`;
  34.         if (size($panels) == 0) {
  35.             //  
  36.             //  Currently no panels so use the new file panels configuration.
  37.             //
  38.             buildNewSceneUI;
  39.         } else {
  40.             //
  41.             //  Check that filters exist
  42.             //
  43.             string $filters[] = `ls -type objectFilter`;
  44.             if (size($filters) == 0) {
  45.                 initDefaultFilters;
  46.             }
  47.  
  48.             //
  49.             //  Init any panels that need it.
  50.             //
  51.             string $panels[] = `getPanel -all`;
  52.             string $panel;
  53.  
  54.             for ($panel in $panels) {
  55.                 if (`panel -q -ni $panel`) {
  56.                     panel -e -init $panel;
  57.                 }
  58.             }
  59.  
  60.             //
  61.             //  get current state of the UI
  62.             //
  63.             sceneUIReplacement -update $gMainPane;
  64.  
  65.             int    $menusOkayInPanels = `optionVar -q allowMenusInPanels`;
  66.             //
  67.             //    Initialize the Relationship Editor.
  68.             //
  69.             if (`exists relationshipEditor`) {
  70.                 $panelLabel = "Relationship Editor";
  71.                 $panelName = 
  72.                     `sceneUIReplacement 
  73.                              -getNextScriptedPanel"relationshipPanel" 
  74.                              $panelLabel`;
  75.                 if ("" == $panelName) {
  76.                     $panelName = `scriptedPanel -mbv $menusOkayInPanels
  77.                                     -unParent -type "relationshipPanel" 
  78.                                     -l $panelLabel`;
  79.                 } else {
  80.                     scriptedPanel -edit -l $panelLabel $panelName;
  81.                 }
  82.             }
  83.  
  84.             string $match, $relationshipEditorPanel = "";
  85.  
  86.             //    Find the Relationship Editor panel.
  87.             //
  88.             string $allPanels[] = `getPanel -allPanels`;
  89.             for ($panel in $allPanels) {
  90.                 $match = match("relationshipPanel", $panel);
  91.                 if ("" != $match) {
  92.                     $relationshipEditorPanel = $panel;
  93.                     break;
  94.                 }
  95.             }
  96.  
  97.             //    Check if Set Editor or Shading Group Editor is one of the visible
  98.             //    panels.  If they are then replace them with the Relationship Editor.
  99.             //
  100.             $allPanels = `getPanel -allPanels`;
  101.             for ($panel in $allPanels) {
  102.                 $match = match("setEditor", $panel);
  103.                 if ("" != $match) {
  104.                     warning ("The scene has a Set "
  105.                         + "Editor in it.  This editor is replaced by the "
  106.                         + "Relationship Editor in Maya 2.0.");
  107.                     if ("" != $relationshipEditorPanel) {
  108.                         scriptedPanel -edit -replacePanel $panel $relationshipEditorPanel;
  109.                     }
  110.                     deleteUI -panel $panel;
  111.                 }
  112.                 $match = match("shadingGroupEditor", $panel);
  113.                 if ("" != $match) {
  114.                     warning ("The scene has a Shading "
  115.                         + "Group Editor in it.  This editor is replaced by "
  116.                         + "the Relationship Editor in Maya 2.0.");
  117.                     if ("" != $relationshipEditorPanel) {
  118.                         scriptedPanel -edit -replacePanel $panel $relationshipEditorPanel;
  119.                     }
  120.                     deleteUI -panel $panel;
  121.                 }
  122.             }
  123.             updatePanelLayoutFromCurrent( "Current Layout" );
  124.  
  125.             //
  126.             // Make sure Hypershade and Visor panels are present.
  127.             //
  128.             int    $menusOkayInPanels = `optionVar -q allowMenusInPanels`;
  129.             string $panelName, $editorName;
  130.  
  131.             string $panels[] = `getPanel -scriptType "hyperShadePanel"`;
  132.             if (`size($panels)` == 0) {
  133.                 $panelName = 
  134.                     `scriptedPanel 
  135.                         -menuBarVisible $menusOkayInPanels 
  136.                         -unParent 
  137.                         -type "hyperShadePanel" 
  138.                         -label "Hypershade"`;
  139.             }
  140.  
  141.             $panels = `getPanel -scriptType "visorPanel"`;
  142.             if (`size($panels)` == 0) {
  143.                 $panelName = 
  144.                     `scriptedPanel 
  145.                         -menuBarVisible $menusOkayInPanels 
  146.                         -unParent 
  147.                         -type "visorPanel" 
  148.                         -label "Visor"`;
  149.                 $editorName = ($panelName+"VisorEd");
  150.                 hyperGraph -e 
  151.                     -graphType "Visor" 
  152.                     -dn defaultShaderList
  153.                     $editorName;
  154.             }
  155.  
  156.             // Make sure the clip editor exists.
  157.             $panels = `getPanel -scriptType "clipEditorPanel"`;
  158.             if (`size($panels)` == 0) {
  159.                 $panelName = `scriptedPanel -mbv $menusOkayInPanels 
  160.                                 -unParent -type "clipEditorPanel" -l "Trax Editor"`;
  161.                 $editorName = ($panelName+"ClipEditor");
  162.             }
  163.  
  164.             // Make sure the Reference Editor panel exists.
  165.             //
  166.             string $panels[] = `getPanel -scriptType "referenceEditorPanel"`;
  167.             if (`size($panels)` == 0) {
  168.                 $panelName = `scriptedPanel -mbv $menusOkayInPanels
  169.                                 -unParent -type "referenceEditorPanel"
  170.                                 -l "Reference Editor"`;
  171.             }
  172.  
  173.             // Turn off isolate select in all model panels
  174.             string $panels[] = `getPanel -type modelPanel`;
  175.             for ($panel in $panels) {
  176.                 modelEditor -edit -viewSelected false $panel;
  177.                 editor -edit -lck -mainListConnection "activeList" $panel;
  178.             }
  179.         }
  180.     }
  181.  
  182.     // reset playblast optionVars
  183.     //
  184.     string $filename = `file -q -sn`;
  185.     if ($filename != "") {
  186.         string $tokens[];
  187.         tokenize($filename,"/",$tokens);
  188.         $filename = $tokens[size($tokens)-1];
  189.         clear $tokens;
  190.         tokenize($filename,".",$tokens);
  191.         $filename = $tokens[0];
  192.     } else {
  193.         // no filename, use "playblast" as the default
  194.         // playblast file name
  195.         $filename = "playblast";
  196.     }
  197.     optionVar -stringValue playblastFile $filename;
  198.  
  199.     if (`isTrue MayaCreatorExists`) {
  200.         //
  201.         //  Make sure that we have a Creator panel.
  202.         //
  203.         string $result[] = `getPanel -scriptType "dynPaintScriptedPanelType"`;
  204.         if ( size( $result ) == 0 ) {
  205.             //  
  206.             //  Need to create a new one.
  207.             //
  208.             string $panelName = `scriptedPanel    -unParent -type "dynPaintScriptedPanelType" -l "Paint Effects" dynPaintScriptedPanel`;
  209.             dynPaintPanel $panelName;
  210.         }
  211.     }
  212. }
  213.